<template>
    <div>
        <headerCom>
            <template v-slot:center>
                <span class="top">
                    营业状态
                </span>
            </template>
        </headerCom>  

        <div class="imgBox" >
            <img src="https://cdn3.axureshop.com/demo/1525603/images/%E8%90%A5%E4%B8%9A%E7%8A%B6%E6%80%81_%E8%90%A5%E4%B8%9A%E4%B8%AD/u1191.png" alt="">
            <p class="state">待营业</p>
        </div>
       
        <div class="text">
            当前店铺处于营业时间之外
        </div>
        <div class="btn">
            <van-button round color="#ff7b57"  size="large" @click="modal">停止营业</van-button>
        </div>
        <p class="text2">
            当您希望长时间不再接收订单时，请点击上方按钮停止营业，开启后需手动恢复。</p>
        <div class="time">外卖营业时段：{{time}}</div>


 <!-- 遮罩层 -->
        <van-overlay :show="show">
            <div class="wrapper">
                <div class="block">
                    <div class="help_title">
                        <p>已被置休</p>
                    </div>
                    <div class="all_text">
                        <div class="text_box">
                            <p>从现在起不接收新单，手动恢复营业后可正常接收新单</p>
                            <span></span>
                        </div>
                    </div>
                    <van-button class="btn2" round color="#ff7b57"  @click=toHome>确认</van-button>

                </div>
            </div>
        </van-overlay>
    </div>


</template>

<script>
import headerCom from '../../components/headerView.vue'
import Vue from 'vue';
import { Overlay } from 'vant';
Vue.use(Overlay);

//调用vuex修改营业状态
import { mapMutations } from "vuex";
export default {
    data() {
        return {
            show: false,   //遮罩层的显示
            time:'11:00-14:00, 17:00-20:00'    //从后端获取
        }
    }, 
    components:{
        headerCom
    },
    methods: {
        back() {
            this.$router.go(-1)
        },
        modal(){  //控制遮罩层的显示
            this.show=true
        },
        ...mapMutations(['setBusinessStatus']),
        toHome(){   //状态更改，调整为营业
            this.show=false
            this.setBusinessStatus('营业中')
            this.$router.push('/tar')


        }
    }
}
</script>

<style scoped>

     .top{
        margin: auto;
    }
    .imgBox{
        width: 150px;
        height: 136px;
        margin: 60px auto 20px;
        position: relative;
    }
    .imgBox img{
        width:100%;
        height: 100%;

    }
    .state{
        font-size: 18px;
        color: #FF6E53;
        position: absolute;
        top: 68px;
        left: 50px;
    }
    .text{
        width: 90%;
        margin: auto;
        text-align: center;
        font-size: 14px;
    }
    .text2{
        color: #797979;
        width: 85%;
        margin: auto;
        font-size: 14px;
    }
.btn{
    width: 88%;
    margin: 30px auto 20px;
}
.time{
    width: 100%;
  color: #ff6e53;
  font-size: 14px;
  text-align: center;
  position: absolute;
  bottom: 30px;

}

  /* 遮罩层 */
  .wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.block {
    width: 80%;
    border-radius: 15px;
    background-color: #fff;
    text-align: center;
}

.btn2 {
    /* border: 1px solid #ff6e53; */
    height: 36px;
    width: 60%;
    margin: 20px auto;
}

.van-overlay {
    background-color: rgba(0, 0, 0, .5);
}

/* 如何选择 */
.help_title {
    font-size: 18px;
}

.all_text {
    width: 90%;
    margin: 0 auto;
}

.text_box p {
    font-size: 14px;
    line-height: 15px;
    font-weight: 400;
    color:#333333;
    text-align: center;

}
</style>